package com.hb.trade.server.project.section.service.item;

import com.hb.core.pojo.enums.CommonTypeEnum;
import com.hb.core.pojo.project.proj.entity.AbstractProject;
import com.hb.core.pojo.project.section.dto.BidSectionDTO;
import com.hb.trade.server.project.proj.service.ProjectService;
import com.hb.trade.server.project.section.manager.BidSectionManager;
import com.hb.trade.server.project.section.service.raw.BidSectionService;
import org.fzzn.core.model.enums.LogicEnum;
import org.fzzn.core.util.Enums;
import org.springframework.stereotype.Service;

import static com.hb.core.pojo.enums.ButtonStatusEnum.DONE;
import static com.hb.core.pojo.enums.ButtonStatusEnum.NONE;

/**
 * 投标/响应
 * 按钮权限方法
 *
 * @author gaoyf
 * @since 2021-9-15 14:21
 */
@Service
public class BidResponseService extends CommonService {

    protected final BidSectionService bidSectionService;
    protected final ProjectService projectService;

    public BidResponseService(BidSectionService bidSectionService,
                              ProjectService projectService) {
        this.bidSectionService = bidSectionService;
        this.projectService = projectService;
    }

    /**
     * 备案查看
     * (原来叫报名, 现在叫备案)
     *
     * @author zhaojk
     * @since 2021-9-15
     */
    public int signupView(BidSectionDTO section) {
        BidSectionManager sectionManager = section.to(BidSectionManager.class);
        AbstractProject project = sectionManager.getProjectInfo();
        // 项目中的是否报名字段
        Integer signUpFlag = project.getSignUpFlag();
        if (Enums.equals(LogicEnum.YES, signUpFlag)) {
            return DONE.getCode();
        }
        return NONE.getCode();
    }

    /**
     * 邀请回执查看
     *
     * @author zhaojk
     * @since 2021-9-15
     */
    public int inviteNackView(BidSectionDTO section) {
        return equals(section, CommonTypeEnum.INVITE);
    }

    /**
     * 下载记录查看
     *
     * @author zhaojk
     * @since 2021-9-15
     */
    public int downloadRecordView(BidSectionDTO section) {
        return DONE.getCode();
    }

    /**
     * 投标信息查看
     *
     * @author zhaojk
     * @since 2021-9-15
     */
    public int tenderInfoView(BidSectionDTO section) {
        return DONE.getCode();
    }

    /**
     * 标书费管理
     *
     * @author zhaojk
     * @since 2021-9-15
     */
    public int tenderDocManager(BidSectionDTO section) {
        return DONE.getCode();
    }

    /**
     * 系统使用费管理
     *
     * @author zhaojk
     * @since 2021-9-15
     */
    public int sysFeeManager(BidSectionDTO section) {
        return DONE.getCode();
    }

    /**
     * 投标保证金管理
     *
     * @author zhaojk
     * @since 2021-9-15
     */
    public int bondManager(BidSectionDTO section) {
        return DONE.getCode();
    }

    /**
     * 递交投标文件
     *
     * @author zhaojk
     * @since 2021-9-15
     */
    public int submitTenderDoc(BidSectionDTO section) {
        return DONE.getCode();
    }
}
